import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);
const state = {
    iswinds: false,
};

const store = new Vuex.Store({
    state,
    mutations: {
        removeState(e) {
            // console.log(e.iswinds);
            if (e.iswinds) {
                this.state.iswinds = false
            } else {
                this.state.iswinds = true
            }
            // console.log(this.state.iswinds);

        },
        saveState() {
            this.state.iswinds = false
        }
    }
});
//提交保存vuex的state
// store.commit('removeState')
//监听页面关闭事件，去存localStorage内
window.onbeforeunload = function() {
    store.commit('saveState')
}
export default store;